<?php

namespace app\common\dao\info;

use app\common\model\info\MapTask as model;
use app\common\dao\BaseDao;

class MapTaskDao extends BaseDao
{
    /**
    * 设置模型
    * @return model
    */
    protected function getModel(): string
    {
        return model::class;
    }

    public function search($where)
    {
        $query = $this->getModel()::getDB();
        $query->when(isset($where['map_type']) && $where['map_type'] !== '', function ($query)use($where){
            $query->where('map_type',$where['map_type']);
        })->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query)use($where){
            $query->where('keyword',"%{$where['keyword']}%");
        })->when(isset($where['uid']) && $where['uid'] !== '', function ($query)use($where){
            $query->where('uid',$where['uid']);
        });

        return $query;
    }


}